<template>
  <view class="index-navbar">
    <view class="nav-item" v-for="(itm, idx) in datalist" :key="idx" @click="toDetail(itm)">
      <image class="img" :src="itm.image"></image>
      <view class="nav-tit one-ellipsis">{{ itm.name }}</view>
    </view>
    <!-- <view class="nav-item">
      <image class="img" :src="getImageSrc('static/icons/chongdian.png')"></image>
      <view class="nav-tit one-ellipsis">充电业务</view>
    </view>
    <view class="nav-item">
      <image class="img" :src="getImageSrc('static/icons/wangdian.png')"></image>
      <view class="nav-tit one-ellipsis">销售网点</view>
    </view>
    <view class="nav-item">
      <image class="img" :src="getImageSrc('static/icons/fuwu.png')"></image>
      <view class="nav-tit one-ellipsis">金融服务</view>
    </view>
    <view class="nav-item">
      <image class="img" :src="getImageSrc('static/icons/shouhou.png')"></image>
      <view class="nav-tit one-ellipsis">售后服务</view>
    </view> -->
  </view>
</template>

<script setup>
import { onMounted, ref } from "vue"
import { router } from "@/path/router";
import service from "@/path/service"
import { getImageSrc } from '@/path/until';
const datalist = ref([])
onMounted(() => {
  service.get("api/ycg/home/articlecategory").then((res) => {
    datalist.value = res
  })
})
function toDetail(itm) {
  router.navigate({ url: "/pages/tool/article/index" }, {
    data: {
      richTextId: itm.id,
      type:"articlecategory"
    }
  })
}
</script>

<style lang="less" scoped>
@import url(./index.less);
</style>
